﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FrmClock.Service;

namespace FrmClock
{
    /// <summary>
    /// 新建一个时间显示窗口
    /// </summary>
    public partial class FrmClock : Form
    {
        //声明进度条组件
        public ProgressBar[] Bars = new ProgressBar[42];
        public FrmClock()
        {
            InitializeComponent();
            
        }
        /// <summary>
        /// 时间随着计时器更新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimerClock_Tick(object sender, EventArgs e)
        {
            LblTime.Text = DateTime.Now.ToString();
            TimeStripStatusLabel1.Text = DateTime.Now.ToString();
            FormService.GetTimeChange(Bars);
        }
        /// <summary>
        /// 生成时间显示器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmClock_Load(object sender, EventArgs e)
        {
            LblTime.Left = (this.Width - LblTime.Width) / 2-150;
            LblTime.Top = (this.Height - LblTime.Height) / 2 - 150;
            //标签显示时间
            LblTime.Text = DateTime.Now.ToString();
            //底部菜单显示时间
            TimeStripStatusLabel1.Text = DateTime.Now.ToString();
            //获取时间显示器控件
            int left = 0;
            for (int i = 0; i < 6; i++)
            {
                GetComponent.GetTimeShow(panel1, Bars, left, 0,7*i);
                left = left + 80;
                //显示当前时间
                FormService.GetTimeNow(Bars, i%7,i);
            }
        }
        
    }
}
